//使用mixin做全局混入。
export default {
    methods: {
        hasText: function (str) {//非空判断
            if (str == null || str == '' || str == undefined || str.length == 0) {
                return false;
            }
            return true;
        },
        openLoadingView(text) {
            if (!text) {
                text = "Loading";
            }
            this.loadingView = this.$loading({
                lock: true,
                text: text
            });
        },
        getRanDomString: function () {
            let text = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
            let rdmIndex = text => Math.random() * text.length | 0;
            let rdmString = '';
            for (; rdmString.length < 32; rdmString += text.charAt(rdmIndex(text))) ;

            return rdmString;
        },
        initQiNiuToken: function () {
            this.$axios.post('user/getToken').then((response) => {
                if (response.data.code == 0) {
                    this.updaLoadData.token = response.data.data;
                } else {
                    this.$message.error("请检查网络连接");
                    return false;
                }
            }).catch(() => {

            });
        }
    },
    data() {
        return {
            loadingView: null,
            opt: {//遮罩层
                lock: false,
                text: '正在加载.....',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
            },
            jwt: '',
            userInfo:{},
            AndroidApkUrl: 'javaScript:;',
            IosUrl: 'javaScript:;',
            uploadURL:'http://45.248.9.38:8885/clock-setting/addImage'
        }
    }
}
